fldmeta_prop.func.UserTask = {};
fldmeta_prop.func.UserTask.predefined = {};

//选择表单
//来自表单变量
fldmeta_prop.func.UserTask.selectForm = function(rId, cId) {
	
	var w1 = fm_createCenterWindow('wid_selectForm', fmd_i18n_prop_selectformversion, 800, 600);
	var lo = w1.attachLayout("2E");
	lo.cells('a').hideHeader();
	lo.cells('b').hideHeader();
	lo.cells('b').setHeight(50);
	
	var str2 = [
		   		{ type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"333":"343"), offsetTop:"0", list:[
		   		{ type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }
		   		]  }
		   	];
	var fm2 = lo.cells('b').attachForm(str2);
	var lo1 = lo.cells('a').attachLayout("2U");
	lo1.cells('a').setText(fmd_i18n_prop_form);
	lo1.cells('b').setText(fmd_i18n_prop_version);
	lo1.setAutoSize("a;b", "a;b");
	lo1.cells('a').setWidth(400);
	var fmg = {};
	fmg.rest_queryf = flvar.fmdCtx + '/rest/fmd/queryForm';
	fmg.rest_queryv = flvar.fmdCtx + '/rest/fmd/queryVersion';
	
	utp_initFormgrid();
	utp_initVersiongrid();
	
	fm2.attachEvent("onButtonClick", function(btid) {
		if (btid=='fb_ok') {
			var rid = fmg.vergrid.getSelectedRowId();
			if (!rid) {
				msg(fmd_i18n_msg_plsselformver);
				return;
			}
			utp_returnBindingForm(rid);
		}
	});
	
	//查询
	utp_toPagef(1, 10);
	
	//grid for form layout
	function utp_initFormgrid() {
		fmg.stb = lo1.cells('a').attachStatusBar();
		fmg.stb.setText("<div id='id_paging_stb1'></div>");
		
		fmg.formgrid = lo1.cells('a').attachGrid();
		fmg.formgrid.setIconsPath(dhtmlx.image_path);
		fmg.formgrid.setHeader([fmd_i18n_l_no,"FORMID",fmd_i18n_prop_form_type,fmd_i18n_prop_form_name,fmd_i18n_prop_form_desc,fmd_i18n_prop_form_creator,fmd_i18n_prop_form_creatorname,"OP"],null,["text-align:center;","text-align:center;","text-align:center","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;"]);
		fmg.formgrid.attachHeader("#rspan,&nbsp;,#rspan,<input id='sr_formname' type='text' style='width:90%'/>,<input id='sr_formdesc' type='text' style='width:90%'/>,#rspan,#rspan,#rspan");
		fmg.formgrid.setInitWidths("40,200,80,150,250,60,80,100");
		fmg.formgrid.setColumnIds("ROW_NO,FORMID,FORMTYPE,FORMNAME,FORMDESC,CREATOR,CREATORNAME,OP");
		fmg.formgrid.setColTypes("ro,ro,pairro,ro,ro,ro,ro,ro");
		fmg.formgrid.setColSorting("na,str,str,str,str,str,str,str");
		fmg.formgrid.setColumnsVisibility("false,true,true,false,false,true,false,true");
		fmg.formgrid.setColAlign("center,left,center,left,left,left,center,left");
		fmg.formgrid.setEditable(false);
		fmg.formgrid.setLang(flvar.lang);
		//default ordering
		fmg.formgrid._grid_ordercolumns = [{"CREATETIME":"DESC"}];
		
		//paging
		fmg.formgrid.setPagingWTMode(true,true,true,[10,20,50,100]);
		fmg.formgrid.enablePaging(true,10,5,'id_paging_stb1');
		fmg.formgrid.setPagingSkin("toolbar", dhx_skin);
		
		fmg.formgrid.init();
		
		fmg.formgrid.attachEvent("onPageChanged", function(ind,fInd,lInd){
			utp_toPagef(fInd+1, lInd);
		});
		
		fmg.formgrid.attachEvent("onSelectStateChanged", function(grId){
			utp_toPagev(1, 10);
		});
		
		//header click event
		fmg.formgrid.attachEvent("onHeaderClick", grid_onHeaderClick);
		
		//bind searcher event
		//disable onclick order by function for this header
		var tdsr_formname = $("#sr_formname").parents('td:first');
		var tdsr_formdesc = $("#sr_formdesc").parents('td:first');
		var tdsr_formdescnext = $("#sr_formdesc").parents('td:first').next();
		tdsr_formname.bind('click',utp_stopEvent);
		tdsr_formdesc.bind('click',utp_stopEvent);
		tdsr_formdescnext.bind('click',utp_stopEvent);
		tdsr_formname.bind('mouseover',utp_stopEvent);
		tdsr_formdesc.bind('mouseover',utp_stopEvent);
		tdsr_formdescnext.bind('mouseover',utp_stopEvent);
		$("#sr_formname").bind('keypress', utp_enterQueryf);
		$("#sr_formdesc").bind('keypress', utp_enterQueryf);
	}

	//grid for version layout
	function utp_initVersiongrid() {
		fmg.vtb = lo1.cells('b').attachStatusBar();
		fmg.vtb.setText("<div id='id_paging_stb2'></div>");
		
		fmg.vergrid = lo1.cells('b').attachGrid();
		fmg.vergrid.setIconsPath(dhtmlx.image_path);
		fmg.vergrid.setHeader([fmd_i18n_l_no,"VERSIONID",fmd_i18n_prop_form_name,fmd_i18n_prop_form_desc,fmd_i18n_prop_form_updatetime,fmd_i18n_prop_form_changeuserid,fmd_i18n_prop_form_changeusername,fmd_i18n_prop_form_checkoutby,fmd_i18n_prop_form_checkoutbyname,fmd_i18n_prop_form_creator,fmd_i18n_prop_form_creatorname,fmd_i18n_prop_form_status,"OP"],
				null,
				["text-align:center;","text-align:left;","text-align:left","text-align:left","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;","text-align:center;"]);
		fmg.vergrid.attachHeader("#rspan,#rspan,<input id='sr_versionname' type='text' style='width:90%'/>,<input id='sr_versiondesc' type='text' style='width:90%'/>,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan");
		fmg.vergrid.setInitWidths("40,100,150,250,120,80,80,80,80,80,80,80,100");
		fmg.vergrid.setColumnIds("ROW_NO,VERSIONID,VERSIONNAME,VERSIONDESC,UPDATETIME,CHANGEUSERID,CHANGEUSERNAME,CHECKOUTBY,CHECKOUTBYNAME,CREATOR,CREATORNAME,STATUS,OP");
		fmg.vergrid.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,pairro,ro");
		fmg.vergrid.setColSorting("na,str,str,str,str,str,str,str,str,str,str,str,str");
		fmg.vergrid.setColumnsVisibility("false,true,false,false,false,true,false,true,false,true,false,true,true");
		fmg.vergrid.setColAlign("center,left,left,left,center,center,center,center,center,center,center,center,center");
		fmg.vergrid.setEditable(false);
		fmg.vergrid.setLang(flvar.lang);
		fmg.vergrid.init();
		
		//default order by
		//fmg.vergrid._grid_ordercolumns = [{"CREATETIME":"DESC"}];
		
		//paging
		fmg.vergrid.setPagingWTMode(true,true,true,[10,20,50,100]);
		fmg.vergrid.enablePaging(true,10,5,'id_paging_stb2');
		fmg.vergrid.setPagingSkin("toolbar", dhx_skin);
		
		fmg.vergrid.attachEvent("onPageChanged", function(ind,fInd,lInd){
			utp_toPagev(fInd+1, lInd);
		});
		
		//header click event
		fmg.vergrid.attachEvent("onHeaderClick", grid_onHeaderClick);
		
		fmg.vergrid.attachEvent("onRowDblClicked", function(grId, gcInd){
			utp_returnBindingForm(grId);
		});
		
		//bind searcher event
		//disable onclick order by function for this header
		var trsr_versionname = $("#sr_versionname").parents('tr:first');
		trsr_versionname.find('td').bind('click',utp_stopEvent);
		trsr_versionname.find('td').bind('mouseover',utp_stopEvent);
		$("#sr_versionname").bind('keypress', utp_enterQueryv);
		$("#sr_versiondesc").bind('keypress', utp_enterQueryv);
	}
	
	//query form
	function utp_toPagef(fromRow, toRow){
		lo1.cells('a').progressOn();
		var p = {"form":{"formtype":"PROCESS"}, "fromRow":fromRow, "toRow":toRow, "timezoneOffset":new Date().getTimezoneOffset(),
				"ordercolumns":JSON.stringify(fmg.formgrid._grid_ordercolumns)};
		if (fmg.fquery_formname) {
			p.form.formname = fmg.fquery_formname;
		}
		if (fmg.fquery_formdesc) {
			p.form.formdesc = fmg.fquery_formdesc;
		}
		p.form = JSON.stringify(p.form);
		var ret = doPostSyncJson(fmg.rest_queryf, p);
		if (!ret) {
			lo1.cells('a').progressOff();
			msgErr(fmd_i18n_msg_readfail);
			return;
		}
		fmg.formgrid.clearAllInPaging();
		fmg.formgrid.parse(ret, "json");
		fmg.vergrid.clearAllInPaging();
		lo1.cells('a').progressOff();
	}

	//call query form
	function utp_enterQueryf(e) {
		if (e.keyCode==13) {
			fmg.fquery_formname = $.trim($("#sr_formname").val());
			fmg.fquery_formdesc = $.trim($("#sr_formdesc").val());
			utp_toPagef(1, 10);
		}
	}

	//query version
	function utp_toPagev(fromRow, toRow){
		lo1.cells('b').progressOn();
		var p = {"args":{"excludeCurrent":"1"}, "fromRow":fromRow, "toRow":toRow, "timezoneOffset":new Date().getTimezoneOffset(),
				"ordercolumns":JSON.stringify(fmg.vergrid._grid_ordercolumns)};
		p.args.formid = fmg.formgrid.cells(fmg.formgrid.getSelectedRowId(), fmg.formgrid.getColIndexById("FORMID")).getValue();
		if (fmg.vquery_versionname) {
			p.args.versionname = fmg.vquery_versionname;
		}
		if (fmg.vquery_versiondesc) {
			p.args.versiondesc = fmg.vquery_versiondesc;
		}
		p.args = JSON.stringify(p.args);
		var ret = doPostSyncJson(fmg.rest_queryv, p);
		if (!ret) {
			lo1.cells('b').progressOff();
			msgErr(fmd_i18n_msg_readfail);
			return;
		}
		fmg.vergrid.clearAllInPaging();
		fmg.vergrid.parse(ret, "json");
		//hide current version display
		var sr = fmg.vergrid.findCell("0",fmg.vergrid.getColIndexById("VERSIONID"),true);
		if (sr && sr.length && sr[0].length) {
			fmg.vergrid.setRowHidden(sr[0][0]);
		}
		lo1.cells('b').progressOff();
	}

	//call query version
	function utp_enterQueryv(e) {
		if (e.keyCode==13) {
			fmg.vquery_versionname = $.trim($("#sr_versionname").val());
			fmg.vquery_versiondesc = $.trim($("#sr_versiondesc").val());
			utp_toPagev(1, 10);
		}
	}

	//stop event propagation
	function utp_stopEvent(e){
		if (e && e.stopPropagation!=undefined) {
			e.stopPropagation();
		} else if (window.event){
			window.event.cancelBubble = true;
		}
		return false;
	}
	
	//返回
	function utp_returnBindingForm(rid) {
		var newval = {};
		var frid = fmg.formgrid.getSelectedRowId();
		newval.formid = fmg.formgrid.cells(frid, fmg.formgrid.getColIndexById("FORMID")).getValue();
		newval.formname = fmg.formgrid.cells(frid, fmg.formgrid.getColIndexById("FORMNAME")).getValue();
		newval.versionid = fmg.vergrid.cells(rid, fmg.vergrid.getColIndexById("VERSIONID")).getValue();
		newval.versionname= fmg.vergrid.cells(rid, fmg.vergrid.getColIndexById("VERSIONNAME")).getValue();
		newval.displayValue = newval.formname + " : " + newval.versionname;
		fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
		w1.close();
	}
	
}

//选择指定用户
fldmeta_prop.func.UserTask.selectUser = function(rId, cId) {
	var w1 = fm_createCenterWindow('wid_assigneeUser', fmd_i18n_prop_assignee_user, 400, 400);
	
	var lo1 = w1.attachLayout("2E");
	lo1.cells('a').hideHeader();
	lo1.cells('b').hideHeader();
	lo1.cells('b').setHeight(50);
	
	var str2 = [
		   		{ type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"130":"140"), offsetTop:"0", list:[
		   		{ type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }
		   		]  }
		   	];
	var fm2 = lo1.cells('b').attachForm(str2);
	
	//grid
	var ragrid = lo1.cells('a').attachGrid();
	ragrid.setHeader(["NO","ROEID",
	                  fmd_i18n_prop_loginname,
	                  fmd_i18n_prop_displayname],
	                    null,
	                    ["text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;"]);
	ragrid.setInitWidths("60,60,180,180");
	ragrid.setColumnIds("NO,ROLEID,USERID,USERNAME");
	ragrid.setColTypes("ro,ro,ro,ro");
	ragrid.setColSorting("int,na,str,str");
	ragrid.setColumnsVisibility("true,true,false,false");
	ragrid.setColAlign("center,center,left,left");
	ragrid.setEditable(false);
	ragrid.setLang(flvar.lang);
	ragrid.init();
	
	ragrid.attachEvent("onRowDblClicked", function(rid) {
		var newval = {"userId":ragrid.cells(rid, 2).getValue(), 
				"userName":ragrid.cells(rid, 3).getValue()};
		fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
		/*if (fl.curComp && fl.curComp.id && fl.curflow.bpmnConfig && fl.curflow.bpmnConfig[fl.curComp.id]) {
			fl.curflow.bpmnConfig[fl.curComp.id][rId] = newval;
		}*/
		w1.close();
	});
	
	fm2.attachEvent("onButtonClick", function(btid) {
		if (btid=='fb_ok') {
			/*var rid = ragrid.getSelectedRowId();
			if (!rid) {
				msg(fmd_i18n_prop_msg_plsselline);
				return;
			}
			var newval = {"userId":ragrid.cells(rid, 2).getValue(), 
					"userName":ragrid.cells(rid, 3).getValue()};*/
			var newval = {"ids":"admin", 
					"names":"超级管理员"};
			fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
			w1.close();
		}
	});
};

//选择指定角色
fldmeta_prop.func.UserTask.selectRole = function(rId, cId) {
	var w1 = fm_createCenterWindow('wid_selectRole', fmd_i18n_prop_selrole, 600, 600);
	var bom = {};
	
	var lo1 = w1.attachLayout("2E");
	lo1.cells('a').hideHeader();
	lo1.cells('b').hideHeader();
	lo1.cells('b').setHeight(50);
	bom.stb = lo1.cells('a').attachStatusBar();
	bom.stb.setText("<div id='id_selectRole_paging_stb1'></div>");
	
	var str2 = [
		   		{ type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"233":"237"), offsetTop:"0", list:[
		   		{ type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }
		   		]  }
		   	];
	var fm2 = lo1.cells('b').attachForm(str2);
	
	//grid
	var ragrid = lo1.cells('a').attachGrid();
	ragrid.setHeader([fmd_i18n_order,
	                  "ROLE_ID",
	                  fmd_i18n_prop_selrole,
	                  fmd_i18n_prop_description],
	                  null,
	                    ["text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;"]);
	ragrid.attachHeader("#rspan,&nbsp;,"+
			"<input id='sr_boname' type='text' style='width:90%'/>,"+
			"<input id='sr_bodesc' type='text' style='width:90%'/>");
	ragrid.setInitWidths("60,60,200,280");
	ragrid.setColumnIds("NO,ROLE_ID,ROLE_NAME,ROLE_DESC");
	ragrid.setColTypes("ro,ro,ro,ro");
	ragrid.setColSorting("int,na,str,str");
	ragrid.setColumnsVisibility("false,true,false,false");
	ragrid.setColAlign("center,left,left,left");
	ragrid.setEditable(false);
	ragrid.setLang(flvar.lang);
	
	//paging
	ragrid.setPagingWTMode(true,true,true,[10,20,50,100]);
	ragrid.enablePaging(true,10,5,'id_selectRole_paging_stb1');
	ragrid.setPagingSkin("toolbar", dhx_skin);
	
	//default ordering
	ragrid.grid_setOrderColumns([{"CREATE_TIME":"DESC"}]);
	
	ragrid.init();
	
	ragrid.attachEvent("onPageChanged", function(ind,fInd,lInd){
		bom_toPage(fInd+1, lInd);
	});
	
	//header click event
	ragrid.attachEvent("onHeaderClick", grid_onHeaderClick);
	
	ragrid.attachEvent("onRowDblClicked", function(rid) {
		var newval = {"roleId":ragrid.cells(rid, 1).getValue(), 
				"roleName":ragrid.cells(rid, 2).getValue()};
		fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
		w1.close();
	});
	
	fm2.attachEvent("onButtonClick", function(btid) {
		if (btid=='fb_ok') {
			var rid = ragrid.getSelectedRowId();
			if (!rid) {
				msg(fmd_i18n_prop_msg_plsselline);
				return;
			}
			var newval = {"roleId":ragrid.cells(rid, 1).getValue(), 
					"roleName":ragrid.cells(rid, 2).getValue()};
			fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
			w1.close();
		}
	});
	
	//bind searcher event
	//disable onclick order by function for this header
	var trsr_boname = $("#sr_boname").parents('tr:first');
	trsr_boname.find('td').bind('click',bom_stopEvent);
	trsr_boname.find('td').bind('mouseover',bom_stopEvent);
	$("#sr_boname").bind('keypress', bom_enterQuery);
	$("#sr_bodesc").bind('keypress', bom_enterQuery);
	
	//query
	bom_toPage(1, 10);
	
	//call query bo
	function bom_enterQuery(e) {
		if (e.keyCode==13) {
			bom.boquery_boname = $.trim($("#sr_boname").val());
			bom.boquery_bodesc = $.trim($("#sr_bodesc").val());
			bom_toPage(1, 10);
		}
	}

	//query bo
	function bom_toPage(fromRow, toRow){
		lo1.progressOn();
		var p = {"queryParams":{}, "fromRow":fromRow, "toRow":toRow, "timezoneOffset":new Date().getTimezoneOffset(),
				"ordercolumns":JSON.stringify(ragrid._grid_ordercolumns)};
		bom.boquery_boname && (p.queryParams.roleName = bom.boquery_boname);
		bom.boquery_bodesc && (p.queryParams.roleDesc = bom.boquery_bodesc);
		p.queryParams = JSON.stringify(p.queryParams);
		var ret = doPostAsyncJson(flvar.restCtx + '/auth/role/queryDhx', p, function(ret){
			if (!ret) {
				lo1.progressOff();
				msgErr(fmd_i18n_msg_readfail);
				return;
			}
			ragrid.clearAllInPaging();
			ragrid.parse(ret, "json");
			lo1.progressOff();
		});
	}

	//stop event propagation
	function bom_stopEvent(e){
		if (e && e.stopPropagation!=undefined) {
			e.stopPropagation();
		} else if (window.event){
			window.event.cancelBubble = true;
		}
		return false;
	}
};

//选择指定岗位
fldmeta_prop.func.UserTask.selectPosition = function(rId, cId) {
	//TODO
	var newval = {};
	newval.id = "postion1";
	newval.displayName= "岗位1";
	newval.deptId = "dept1";
	newval.deptName = "部门1";
	fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
};

//解析表单变量
fldmeta_prop.func.UserTask.parseModelToInputOutput = function(fd1) {
	var mds = fd1.version.formdata.models;
	var input = {};
	for (var md1 in mds) {
		input[md1] = {"desc" : mds[md1].bodesc, "children":{}};
		for (var at1 in mds[md1].attrs) {
			input[md1].children[at1] = {"type":mds[md1].attrs[at1].type, "desc":mds[md1].attrs[at1].zh};
		}
	}
	if (MyUtilJs.isEmpty(input)) {
		return null;
	} else {
		return {"input":input, "output":input};
	}
};

//来自表单变量
fldmeta_prop.func.UserTask.selectFormvar = function(rId, cId) {
	
	var form1 = fmdc.grid_prop.cells("formBinding", fldmeta_prop.gridconf.idx.value).getValue();
	//console.log(form1);
	if (!MyUtilJs.isEmpty(form1)) {
		doPostAsyncJson(fmg.rest_queryv, {"formid":form1.formid, "versionid":form1.versionid},
				function(ret){
					//console.log(ret);
					var r1 = fldmeta_prop.func.UserTask.parseModelToInputOutput(ret);
					if (!r1) {
						msg(fmd_i18n_msg_invalidmodelinform);
					} else {
						utp_callSelectFormvar(rId, cId, r1);
					}
				}
			);
	} else {
		msg(fmd_i18n_prop_msg_plsselformver);
	}
	
	function utp_callSelectFormvar(rId, cId, r1) {
		var w1 = fm_createCenterWindow('wid_selectFormvar', fmd_i18n_prop_processvars, 400, 600);
		
		var lo1 = w1.attachLayout("2E");
		lo1.cells('a').hideHeader();
		lo1.cells('b').hideHeader();
		lo1.cells('b').setHeight(50);
		
		var str2 = [
			   		{ type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"130":"140"), offsetTop:"0", list:[
			   		{ type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }
			   		]  }
			   	];
		var fm2 = lo1.cells('b').attachForm(str2);
		
		//grid
		var ragrid = lo1.cells('a').attachGrid();
		ragrid.setHeader([fmd_i18n_prop_formvar,
			                    fmd_i18n_prop_type,
			                    fmd_i18n_prop_desc],
			                    null,
			                    ["text-align:center;",
			                     "text-align:center;",
			                     "text-align:center;"]);
		fldmeta_prop.gridconf.treeIconPath && ragrid.setIconPath(fldmeta_prop.gridconf.treeIconPath);
		fldmeta_prop.gridconf.treeImagePath && ragrid.setImagePath(fldmeta_prop.gridconf.treeImagePath);
		fldmeta_prop.gridconf.extIconPath && (ragrid.extIconPath = fldmeta_prop.gridconf.extIconPath);
		ragrid.setInitWidths("170,60,110");
		ragrid.setColumnIds("VARNAME,VARTYPE,VARDESC");
		ragrid.setColTypes("tree,coro,ro");
		ragrid.setColSorting("na,na,na");
		ragrid.setColAlign("left,left,left");
		ragrid.setColumnsVisibility("false,false,false");
		ragrid.setEditable(false);
		ragrid.setLang(flvar.lang);
		ragrid.enableAlterCss("grid_even_row_white","grid_odd_row_white");
		ragrid.init();
		
		ragrid.attachEvent("onRowDblClicked", function(rid) {
			if(!ragrid.getRowAttribute(rid, "isParam")) {
				msg(fmd_i18n_msg_plsselformvar);
				return;
			}
			if('string'!=ragrid.cells(rid, 1).getValue()) {
				msg(fmd_i18n_msg_pvmuststring);
				return;
			}
			var pvar = ragrid.cells(ragrid.getRowAttribute(rid, "rootId"), 0).getValue();
			var pvardesc = ragrid.cells(ragrid.getRowAttribute(rid, "rootId"), 2).getValue();
			var newval = {"varname":ragrid.cells(rid, 0).getValue(), 
					"parentvarname" : pvar,
					"parentvardesc" : pvardesc,
					"vardesc":ragrid.cells(rid, 2).getValue(),
					"displayValue": pvar+"."+ragrid.cells(rid, 0).getValue()+ "("+ragrid.cells(rid, 2).getValue()+")"};
			fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
			w1.close();
		});
		
		//load existing vars
		if (r1) {
			function utp_loadActivityVars(rootId, avlist) {
				if (avlist) {
					var count = 1;
					for (id in avlist) {
						var rid = rootId+"_"+count++;
						ragrid.addRow(rid, [id, avlist[id].type, avlist[id].desc], null, rootId);
						if (avlist[id].type) {
							ragrid.grid_bindCombo(rid, 1, 
									fmd_i18n_prop_processvar_vals, 
									{"comboSize":10, "comboWidth":100}, 
									avlist[id].type);
							//set isParam
							ragrid.setRowAttribute(rid, "isParam", true);
							ragrid.setRowAttribute(rid, "rootId", rootId);
							ragrid.cells(rid, 0).setImage(fmdc.grid_prop.extIconPath+"param.png");
						} else if (avlist[id].children) {
							ragrid.cells(rid, 0).setImage(fmdc.grid_prop.extIconPath+"module.png");
							utp_loadActivityVars(rid, avlist[id].children);
						}
					}
				}
			}
			utp_loadActivityVars(0, r1.input);
			ragrid.expandAll();
		}
		
		fm2.attachEvent("onButtonClick", function(btid) {
			if (btid=='fb_ok') {
				var rid = ragrid.getSelectedRowId();
				if (!rid) {
					msg(fmd_i18n_prop_msg_plsselline);
					return;
				}
				if(!ragrid.getRowAttribute(rid, "isParam")) {
					msg(fmd_i18n_msg_plsselformvar);
					return;
				}
				if('string'!=ragrid.cells(rid, 1).getValue()) {
					msg(fmd_i18n_msg_pvmuststring);
					return;
				}
				var pvar = ragrid.cells(ragrid.getRowAttribute(rid, "rootId"), 0).getValue();
				var pvardesc = ragrid.cells(ragrid.getRowAttribute(rid, "rootId"), 2).getValue();
				var newval = {"varname":ragrid.cells(rid, 0).getValue(), 
						"parentvarname" : pvar,
						"parentvardesc" : pvardesc,
						"vardesc":ragrid.cells(rid, 2).getValue(),
						"displayValue": pvar+"."+ragrid.cells(rid, 0).getValue()+ "("+ragrid.cells(rid, 2).getValue()+")"};
				fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
				w1.close();
			}
		});
	}
}

//来自流程变量
fldmeta_prop.func.UserTask.selectProcessvar = function(rId, cId) {
	var w1 = fm_createCenterWindow('wid_selectProcessvar', fmd_i18n_prop_processvars, 400, 600);
	
	var lo1 = w1.attachLayout("2E");
	lo1.cells('a').hideHeader();
	lo1.cells('b').hideHeader();
	lo1.cells('b').setHeight(50);
	
	var str2 = [
		   		{ type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"130":"140"), offsetTop:"0", list:[
		   		{ type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }
		   		]  }
		   	];
	var fm2 = lo1.cells('b').attachForm(str2);
	
	//grid
	var ragrid = lo1.cells('a').attachGrid();
	ragrid.setHeader([fmd_i18n_prop_variablename,
	                  fmd_i18n_prop_type,
	                  fmd_i18n_prop_allowin,
	                  fmd_i18n_prop_allowout,
	                  	fmd_i18n_prop_desc],
	                    null,
	                    ["text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;", 
	                     "text-align:center;",
	                     "text-align:center;"]);
	ragrid.setInitWidths("80,60,60,60,*");
	ragrid.setColumnIds("VARNAME,VARTYPE,ALLOWIN,ALLOWOUT,VARDESC");
	ragrid.setColTypes("ro,coro,ch,ch,ro");
	ragrid.setColSorting("str,str,int,int,na");
	ragrid.setColAlign("left,left,center,center,left");
	ragrid.setColumnsVisibility("false,false,true,true,false");
	ragrid.setEditable(false);
	ragrid.setLang(flvar.lang);
	ragrid.enableAlterCss("","");
	ragrid.init();
	
	ragrid.attachEvent("onRowDblClicked", function(rid) {
		if('string'!=ragrid.cells(rid, 1).getValue()) {
			msg(fmd_i18n_msg_pvmuststring);
			return;
		}
		var newval = {"varname":ragrid.cells(rid, 0).getValue(), 
				"vardesc":ragrid.cells(rid, 4).getValue(),
				"displayValue": ragrid.cells(rid, 0).getValue()+ "("+ragrid.cells(rid, 4).getValue()+")"};
		fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
		w1.close();
	});
	
	//load existing process vars
	if (fl.curflow.bpmnConfig.processSettings.variables) {
		var count = 1;
		for (id in fl.curflow.bpmnConfig.processSettings.variables) {
			var rid = count++;
			ragrid.addRow(rid, [id, fl.curflow.bpmnConfig.processSettings.variables[id].type,
			                    fl.curflow.bpmnConfig.processSettings.variables[id].allowin, 
			                    fl.curflow.bpmnConfig.processSettings.variables[id].allowout, 
			                    fl.curflow.bpmnConfig.processSettings.variables[id].desc]);
			ragrid.grid_bindCombo(rid, 1, 
					fmd_i18n_prop_processvar_vals, 
					{"comboSize":10, "comboWidth":100}, 
					fl.curflow.bpmnConfig.processSettings.variables[id].type);
		}
	}
	
	fm2.attachEvent("onButtonClick", function(btid) {
		if (btid=='fb_ok') {
			var rid = ragrid.getSelectedRowId();
			if (!rid) {
				msg(fmd_i18n_prop_msg_plsselline);
				return;
			}
			if('string'!=ragrid.cells(rid, 1).getValue()) {
				msg(fmd_i18n_msg_pvmuststring);
				return;
			}
			var newval = {"varname":ragrid.cells(rid, 0).getValue(), 
					"vardesc":ragrid.cells(rid, 4).getValue(),
					"displayValue": ragrid.cells(rid, 0).getValue()+ "("+ragrid.cells(rid, 4).getValue()+")"};
			fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
			w1.close();
		}
	});
}

//选择岗位-不在特定部门
fldmeta_prop.func.UserTask.selectRelationPosition = function(rId, cId) {
	var w1 = fm_createCenterWindow('wid_selectPosition', fmd_i18n_prop_selposition, 600, 600);
	var bom = {};
	
	var lo1 = w1.attachLayout("2E");
	lo1.cells('a').hideHeader();
	lo1.cells('b').hideHeader();
	lo1.cells('b').setHeight(50);
	bom.stb = lo1.cells('a').attachStatusBar();
	bom.stb.setText("<div id='id_selectPosition_paging_stb1'></div>");
	
	var str2 = [
		   		{ type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"233":"237"), offsetTop:"0", list:[
		   		{ type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }
		   		]  }
		   	];
	var fm2 = lo1.cells('b').attachForm(str2);
	
	//grid
	var ragrid = lo1.cells('a').attachGrid();
	ragrid.setHeader([fmd_i18n_order,
	                  "POS_ID",
	                  fmd_i18n_prop_selposition,
	                  fmd_i18n_prop_description],
	                  null,
	                    ["text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;"]);
	ragrid.attachHeader("#rspan,&nbsp;,"+
			"<input id='sr_boname' type='text' style='width:90%'/>,"+
			"<input id='sr_bodesc' type='text' style='width:90%'/>");
	ragrid.setInitWidths("60,60,200,280");
	ragrid.setColumnIds("NO,POS_ID,POS_NAME,POS_DESC");
	ragrid.setColTypes("ro,ro,ro,ro");
	ragrid.setColSorting("int,na,str,str");
	ragrid.setColumnsVisibility("false,true,false,false");
	ragrid.setColAlign("center,left,left,left");
	ragrid.setEditable(false);
	ragrid.setLang(flvar.lang);
	
	//paging
	ragrid.setPagingWTMode(true,true,true,[10,20,50,100]);
	ragrid.enablePaging(true,10,5,'id_selectPosition_paging_stb1');
	ragrid.setPagingSkin("toolbar", dhx_skin);
	
	//default ordering
	ragrid.grid_setOrderColumns([{"CREATE_TIME":"DESC"}]);
	
	ragrid.init();
	
	ragrid.attachEvent("onPageChanged", function(ind,fInd,lInd){
		bom_toPage(fInd+1, lInd);
	});
	
	//header click event
	ragrid.attachEvent("onHeaderClick", grid_onHeaderClick);
	
	ragrid.attachEvent("onRowDblClicked", function(rid) {
		var newval = {"posId":ragrid.cells(rid, 1).getValue(), 
				"posName":ragrid.cells(rid, 2).getValue()};
		fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
		w1.close();
	});
	
	fm2.attachEvent("onButtonClick", function(btid) {
		if (btid=='fb_ok') {
			var rid = ragrid.getSelectedRowId();
			if (!rid) {
				msg(fmd_i18n_prop_msg_plsselline);
				return;
			}
			var newval = {"posId":ragrid.cells(rid, 1).getValue(), 
					"posName":ragrid.cells(rid, 2).getValue()};
			fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
			w1.close();
		}
	});
	
	//bind searcher event
	//disable onclick order by function for this header
	var trsr_boname = $("#sr_boname").parents('tr:first');
	trsr_boname.find('td').bind('click',bom_stopEvent);
	trsr_boname.find('td').bind('mouseover',bom_stopEvent);
	$("#sr_boname").bind('keypress', bom_enterQuery);
	$("#sr_bodesc").bind('keypress', bom_enterQuery);
	
	//query
	bom_toPage(1, 10);
	
	//call query bo
	function bom_enterQuery(e) {
		if (e.keyCode==13) {
			bom.boquery_boname = $.trim($("#sr_boname").val());
			bom.boquery_bodesc = $.trim($("#sr_bodesc").val());
			bom_toPage(1, 10);
		}
	}

	//query bo
	function bom_toPage(fromRow, toRow){
		lo1.progressOn();
		var p = {"queryParams":{}, "fromRow":fromRow, "toRow":toRow, "timezoneOffset":new Date().getTimezoneOffset(),
				"ordercolumns":JSON.stringify(ragrid._grid_ordercolumns)};
		bom.boquery_boname && (p.queryParams.posName = bom.boquery_boname);
		bom.boquery_bodesc && (p.queryParams.posDesc = bom.boquery_bodesc);
		p.queryParams = JSON.stringify(p.queryParams);
		var ret = doPostAsyncJson(ctxpath + '/rest/post/query', p, function(ret){
			if (!ret) {
				lo1.progressOff();
				msgErr(fmd_i18n_msg_readfail);
				return;
			}
			ragrid.clearAllInPaging();
			ragrid.parse(ret, "json");
			lo1.progressOff();
		});
	}

	//stop event propagation
	function bom_stopEvent(e){
		if (e && e.stopPropagation!=undefined) {
			e.stopPropagation();
		} else if (window.event){
			window.event.cancelBubble = true;
		}
		return false;
	}
};

//查找所有前序环节
fldmeta_prop.func.UserTask.getPreActivityNames = function(elemid, diagramJson) {
	//get previous activities
	var preAcs = {};
	//迭代sourceRef
	//TODO 处理死循环
	function appendPreActivityNames(acs) {
		for (var i in acs) {
			var result = JSONSelect.match(':has(:root > .targetRef:val("'+acs[i]+'")) > .sourceRef', diagramJson);
			//console.debug("acs[i] pres="+JSON.stringify(result));
			if (result && result.length) {
				for (var j in result) {
					if (preAcs[result[j]] || result[j]==elemid) {	//如果回溯路径到已存在的环节或当前检测的环节则停止
						break;
					}
					//是否子流程
					if (result[j].indexOf("SubProcess_") >= 0) {
						var elem1 = getIORegistedElem(result[j]);
						var subobj = {"i18nname-zh" : fl.curflow.bpmnConfig[result[j]]["i18nname-zh"] || fmd_i18n_prop_untitled, "collapsed":elem1.collapsed};
						if (elem1.collapsed) {//链接子流程
							if(fl.curflow.bpmnConfig[elem1.id].processRef && fl.curflow.bpmnConfig[elem1.id].processRef.id) {//已选择引用流程
								var versionid = null;	//TODO 引用流程版本问题
								var flow = doGetSyncJson(flvar.bpmeRest + "/flow/"+fl.curflow.bpmnConfig[elem1.id].processRef.id+"/versionWithBpd/"+(versionid!=null?versionid:"current"));
								var bc = JSON.parse(flow.version.bpmnConfig);
								var children = {};	//子流程上的环节
								for (var c in bc) {
									if (c.indexOf("Task_")>=0) {
										children[c] = {"i18nname-zh" : bc[c]["i18nname-zh"]};
										//记录席位任务的视图id -因为是在不同流程中，这里要在验证之前提前记录提高性能
										if ('UserTask'==bc[c].i18ntype && 'roletask'==bc[c].userTaskType
											&& bc[c].roleActivity && bc[c].roleActivity.compid) {
												children[c].roleViewId = bc[c].roleActivity.compid;
				    					}
									}
								}
								subobj.id = fl.curflow.bpmnConfig[elem1.id].processRef.id;
								subobj.children = children;
							}
							//添加到结果
							preAcs[result[j]] = {};
						} else {//内嵌子流程
							var children = {};	//子流程上的环节
							for (var c in elem1.children) {
								//因为内嵌子流程中不能再内嵌其他子流程，这里仅需要记录各种任务环节即可
								if (typeof(elem1.children[c])=="object" && elem1.children[c].id && elem1.children[c].id.indexOf("Task_")>=0) {
									children[elem1.children[c].id] = {"i18nname-zh" : fl.curflow.bpmnConfig[elem1.children[c].id]["i18nname-zh"] || fmd_i18n_prop_untitled};
									//记录席位任务的视图id
									if ('UserTask'==fl.curflow.bpmnConfig[elem1.children[c].id].i18ntype 
											&& 'roletask'==fl.curflow.bpmnConfig[elem1.children[c].id].userTaskType
											&& fl.curflow.bpmnConfig[elem1.children[c].id].roleActivity 
											&& fl.curflow.bpmnConfig[elem1.children[c].id].roleActivity.compid) {
										children[elem1.children[c].id].roleViewId = fl.curflow.bpmnConfig[elem1.children[c].id].roleActivity.compid;
			    					}
								}
							}
							subobj.children = children;
						}
						//添加到结果
						preAcs[result[j]] = subobj;
					} else {
						//主流程上的环节不区分环节类型统一加入列表
						preAcs[result[j]] = {"i18nname-zh" : fl.curflow.bpmnConfig[result[j]]["i18nname-zh"] || fmd_i18n_prop_untitled};
						//记录席位任务的视图id
						if ('UserTask'==fl.curflow.bpmnConfig[result[j]].i18ntype 
								&& 'roletask'==fl.curflow.bpmnConfig[result[j]].userTaskType
								&& fl.curflow.bpmnConfig[result[j]].roleActivity 
								&& fl.curflow.bpmnConfig[result[j]].roleActivity.compid) {
							preAcs[result[j]].roleViewId = fl.curflow.bpmnConfig[result[j]].roleActivity.compid;
    					}
					}
					//迭代
					appendPreActivityNames(result);
				}
			}
		}
	}
	var checkElems = [elemid];
	//如果是内嵌子流程中的任务，需要增加检测作为该任务父节点的子流程节点
	var el1 = getIORegistedElem(elemid);
	if (typeof(el1)=="object" 
		&& el1.businessObject.$parent 
		&& el1.businessObject.$parent.id 
		&& el1.businessObject.$parent.id.indexOf("SubProcess_")>=0) {
			checkElems.push(el1.businessObject.$parent.id);
	}
	//开始查找
	if (diagramJson) {
		appendPreActivityNames(checkElems);
	} else {
		bi.saveDiagram(function(err, xml){
			diagramJson = xml2json.fromStr(xml);
			appendPreActivityNames(checkElems);
			//console.debug(JSON.stringify(preAcs));
		});
	}
	//console.log(elemid+" preAcs result="+JSON.stringify(preAcs));
	return preAcs;
};

//判断一个环节是否为另一环节的前序环节
fldmeta_prop.func.UserTask.isPreActivity = function(post, pre, diagramJson) {
	var pres = fldmeta_prop.func.UserTask.getPreActivityNames(post, diagramJson);
	return pres[pre]!=undefined;
};

//选择可以驳回环节
fldmeta_prop.func.UserTask.selectRejectPath = function(rId, cId) {
	
	//check previous activities
	var preAcs = fldmeta_prop.func.UserTask.getPreActivityNames(fl.curComp.id);
	
	var gd = {"rows":[]};
	/*$("g[data-element-id*='Task_']").each(function(index,element){
		var elemid = $(element).attr("data-element-id");
		gd.rows.push({"id":++count, "data":[1, elemid, fldmeta_prop.func.getCompInnerName(elemid) || fmd_i18n_prop_untitled]});
	});*/
	for (var elemid in preAcs) {
		if (elemid.indexOf("Task_")>=0) {
			gd.rows.push({"id":elemid, "data":[0, elemid, fldmeta_prop.func.getCompInnerName(elemid) || fmd_i18n_prop_untitled]});
		} else if (preAcs[elemid].children) {
			if (preAcs[elemid].collapsed) {//链接子流程
				//do nothing
			} else {//内嵌子流程
				for (var c in preAcs[elemid].children) {
					gd.rows.push({"id":c, "data":[0, c, fldmeta_prop.func.getCompInnerName(c) || fmd_i18n_prop_untitled]});
				}
			}
		}
	}
	//console.debug(JSON.stringify(gd));
	if (gd.rows.length==0) {
		msg(fmd_i18n_msg_noPreActivities);
		return;
	}
	
	var w1 = fm_createCenterWindow('wid_selectRejectPath', fmd_i18n_prop_rejectPathSelect, 400, 600);
	var lo1 = w1.attachLayout("2E");
	lo1.cells('a').hideHeader();
	lo1.cells('b').hideHeader();
	lo1.cells('b').setHeight(50);
	
	//grid
	var ragrid = lo1.cells('a').attachGrid();
	ragrid.setHeader([fmd_i18n_select,
	                  fmd_i18n_prop_id,
	                  fmd_i18n_prop_activityname],
	                    null,
	                    ["text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;"]);
	ragrid.setInitWidths("60,120,*");
	ragrid.setColTypes("ch,ro,ro");
	ragrid.setColSorting("int,str,str");
	ragrid.setColumnsVisibility("false,false,false");
	ragrid.setColAlign("center,left,left");
	ragrid.setEditable(true);
	ragrid.setLang(flvar.lang);
	ragrid.init();
	ragrid.parse(gd, "json");
	
	//set existing values
	var oldval = fl.curflow.bpmnConfig[fl.curComp.id][rId];
	if (oldval && oldval.length>0) {
		for (var i in oldval) {
			ragrid.cells(oldval[i].activityId, 0).setValue(1);
		}
	}
	
	var str2 = [{ type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"130":"140"), offsetTop:"0", list:[
 		   		{ type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }]}];
 	var fm2 = lo1.cells('b').attachForm(str2);
	fm2.attachEvent("onButtonClick", function(btid) {
		if (btid=='fb_ok') {
			var rids = ragrid.getCheckedRows(0).split(",");
			if (!rids || rids.length==0 || ""==rids[0]) {
				msg(fmd_i18n_prop_msg_plsselmulti);
				return;
			}
			var newval = [];
			for (var i=0; i<rids.length; i++) {
				newval.push({"activityId":ragrid.cells(rids[i], 1).getValue(), 
					"activityName":ragrid.cells(rids[i], 2).getValue()});
			}
			fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
			/*if (fl.curComp && fl.curComp.id && fl.curflow.bpmnConfig && fl.curflow.bpmnConfig[fl.curComp.id]) {
				fl.curflow.bpmnConfig[fl.curComp.id][rId] = newval;
			}*/
			w1.close();
		}
	});
};

//选择一个前序环节
fldmeta_prop.func.UserTask.selectPreActivity = function(rId, cId) {
	
	//check previous activities
	var preAcs = fldmeta_prop.func.UserTask.getPreActivityNames(fl.curComp.id);
	
	var gd = {"rows":[]};
	for (var elemid in preAcs) {
		if (elemid.indexOf("Task_")>=0) {
			gd.rows.push({"id":elemid, "data":[0, elemid, fldmeta_prop.func.getCompInnerName(elemid) || fmd_i18n_prop_untitled]});
		} else if (preAcs[elemid].children) {
			if (preAcs[elemid].collapsed) {//链接子流程
				//do nothing
			} else {//内嵌子流程
				for (var c in preAcs[elemid].children) {
					gd.rows.push({"id":c, "data":[0, c, fldmeta_prop.func.getCompInnerName(c) || fmd_i18n_prop_untitled]});
				}
			}
		}
	}
	if (gd.rows.length==0) {
		msg(fmd_i18n_msg_noPreActivities);
		return;
	}
	
	var w1 = fm_createCenterWindow('wid_selectPreActivity', fmd_i18n_prop_rejectPathSelect, 400, 600);
	var lo1 = w1.attachLayout("2E");
	lo1.cells('a').hideHeader();
	lo1.cells('b').hideHeader();
	lo1.cells('b').setHeight(50);
	
	//grid
	var ragrid = lo1.cells('a').attachGrid();
	ragrid.setHeader([fmd_i18n_select,
	                  fmd_i18n_prop_id,
	                  fmd_i18n_prop_activityname],
	                    null,
	                    ["text-align:center;",
	                     "text-align:center;",
	                     "text-align:center;"]);
	ragrid.setInitWidths("60,120,*");
	ragrid.setColTypes("ra,ro,ro");
	ragrid.setColSorting("int,str,str");
	ragrid.setColumnsVisibility("false,false,false");
	ragrid.setColAlign("center,left,left");
	ragrid.setEditable(true);
	ragrid.setLang(flvar.lang);
	ragrid.setColumnsVisibility("true,false,false");
	ragrid.init();
	ragrid.parse(gd, "json");
	
	ragrid.attachEvent("onRowDblClicked", function(rid) {
		var newval = {"activityId":ragrid.cells(rid, 1).getValue(), 
				"activityName":ragrid.cells(rid, 2).getValue()};
		fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
		w1.close();
	});
	
	var str2 = [{ type:"block" , name:"form_block_1", offsetLeft:(dhx_skin=="dhx_web"?"130":"140"), offsetTop:"0", list:[
 		   		{ type:"button" , name:"fb_ok", value:fmd_i18n_b_ok, inputTop:0  }]}];
 	var fm2 = lo1.cells('b').attachForm(str2);
	fm2.attachEvent("onButtonClick", function(btid) {
		if (btid=='fb_ok') {
			var rid = ragrid.getSelectedRowId();
			if (!rid) {
				msg(fmd_i18n_msg_sel);
				return;
			}
			var newval = {"activityId":ragrid.cells(rid, 1).getValue(), 
				"activityName":ragrid.cells(rid, 2).getValue()};
			fmdc.grid_prop.cells(rId, cId).setValue(newval, true);	//第二个参数必须为true，触发事件
			w1.close();
		}
	});
};

//assignType
fldmeta_prop.func.UserTask.predefined["assignType"] = {
		"name" : fmd_i18n_prop_assignType,
		"tooltip" : fmd_i18n_prop_assignType,
    	"img" : "approvalType.png",
    	"cellType" : {
    		"type" : "coro",
    		"options" : fmd_i18n_prop_assignTypes
    	},
    	"value" : {"default":"multiple"},
    	"conditional-sub" : {
    		"multiple" : {
    			"multiApprovalOrder" : {
    		    	"name" : fmd_i18n_prop_multiApprovalOrder,
    		    	"tooltip" : fmd_i18n_prop_multiApprovalOrder,
    		    	"img" : "multiApprovalOrder.png",
    		    	"cellType" : {
    		    		"type" : "coro",
    		    		"options" : fmd_i18n_prop_multiApprovalOrders
				    },
    		    	"value" : {"default":"parallel"}
    		    },
    		    "allowUnInvolve" : {
    		    	"name" : fmd_i18n_prop_allowUnInvolve,
    		    	"tooltip" : fmd_i18n_prop_allowUnInvolve,
    		    	"img" : "allowUnInvolve.png",
    		    	"cellType" : "ch",
    		    	"value" : {"default":0}
    		    }
    		}
    	}
};


//new process remind
fldmeta_prop.func.UserTask.predefined["newTaskRemind"] = {
		"name" : fmd_i18n_prop_newtaskremind,
    	"img" : "ring3.png",
    	"tooltip" : fmd_i18n_prop_newtaskremind,
    	"cellType" : "ch",
    	"value" : {"default":0},
    	"conditional-sub" : {
    		"1" : {
    			"newTaskRemindMethods" : {
    		    	"name" : fmd_i18n_prop_remindmethods,
    		    	"img" : "ring3.png",
    		    	"cellType" : {
						"type" : "colist",
						"config": {
	    		    		"list" : fmd_i18n_prop_remindmethods_vals
	    		    	}
				    },
    		    	"value" : {"default":"email"},
    		    	"validatorFunc" : function(elemid, value, prefix) {
    		    		if (null!=fl.curflow.bpmnConfig[elemid].newTaskRemind && Number(fl.curflow.bpmnConfig[elemid].newTaskRemind) && !value) {
    		    			//return {"type":"error", "msg":fmd_i18n_msg_newtaskremindNoMethod};
    		    			fl_pushValidationErr(elemid, "newTaskRemindMethods", "error", prefix + fmd_i18n_msg_newtaskremindNoMethod);
    		    		}
    		    		return null;
    		    	}
    		    }
    		}
    	}
    };

//allow reject
fldmeta_prop.func.UserTask.predefined["allowReject"] = {
		"name" : fmd_i18n_prop_allowReject,
    	"img" : "allowReject.png",
    	"tooltip" : fmd_i18n_prop_allowReject,
    	"cellType" : "ch",
    	"value" : {"default":0},
    	"conditional-sub" : {
    		"1" : {
    			"rejectPathSelect" : {
    		    	"name" : fmd_i18n_prop_rejectPathSelect,
    		    	"img" : "rejectPathSelect.png",
    		    	"asterisk" : true,
    		    	"cellType" : {
						"type" : "btnex",
						"config" : {
							"onclick" : fldmeta_prop.func.UserTask.selectRejectPath
						}
				    },
    		    	"value" : {"default":null},
    		    	"validatorFunc" : function(elemid, value, prefix) {
    		    		if (null!=fl.curflow.bpmnConfig[elemid].allowReject && Number(fl.curflow.bpmnConfig[elemid].allowReject) && (!value || MyUtilJs.isEmpty(value))) {
    		    			//return {"type":"error", "msg":fmd_i18n_msg_allowRejectNoPath};
    		    			fl_pushValidationErr(elemid, "rejectPathSelect", "error", prefix + fmd_i18n_msg_allowRejectNoPath);
    		    		}
    		    		return null;
    		    	}
    		    }
    		}
    	}
    };

//allow reject
fldmeta_prop.func.UserTask.predefined["isApprovalActivity"] = {
		"name" : fmd_i18n_prop_isApprovalActivity,
    	"img" : "approvalType.png",
    	"tooltip" : fmd_i18n_prop_isApprovalActivity,
    	"cellType" : "ch",
    	"value" : {"default":0},
    	"conditional-sub" : {
    		"1" : {
    		    "multiApprovalEvaluation" : {
    		    	"name" : fmd_i18n_prop_multiApprovalEvaluation,
    		    	"tooltip" : fmd_i18n_prop_multiApprovalEvaluation,
    		    	"img" : "multiApprovalEvaluation.png",
    		    	"cellType" : {
    		    		"type" : "coro",
    		    		"options" : fmd_i18n_prop_multiApprovalEvaluation_enum
				    },
    		    	"value" : {"default":"all"},
    		    	"conditional-sub" : {
    		    		"number" : {
    		    			"multiApprovalEvaluationNumber" : {
    		    				"name" : fmd_i18n_prop_multiApprovalEvaluationNumber,
    		    		    	"tooltip" : fmd_i18n_tip_multiApprovalEvaluationNumber,
    		    		    	"img" : "evaluationNumber.png",
    		    		    	"asterisk" : true,
    		    		    	"cellType" : {
    		    		    		"type" : "jquispinner",
    		    		    		"config" : {
    		    		    			"min" : 1
    		    		    		}
    		    		    	},
    		    		    	"value" : {"default":"1"},
    		    		    	"validator" : "ValidPositiveInteger",
    		    		    	"validatorFunc" : function(elemid, value, prefix) {
    		    		    		if (Number(fl.curflow.bpmnConfig[elemid].isApprovalActivity) &&
    		    		    				'multiple'==fl.curflow.bpmnConfig[elemid].assignType &&
    		    		    				'number'==fl.curflow.bpmnConfig[elemid].multiApprovalEvaluation &&
    		    		    				!dhtmlxValidation.isValidPositiveInteger(value)) {
    		    		    			//return {"type":"error", "msg":fmd_i18n_vld_failed + " " + fldmeta_prop.runtime_validators_i18n["ValidPositiveInteger"]};
    		    		    			fl_pushValidationErr(elemid, "multiApprovalEvaluationNumber", "error", prefix + fmd_i18n_vld_failed + " " + fldmeta_prop.runtime_validators_i18n["ValidPositiveInteger"]);
    		    		    		}
    		    		    		return null;
    		    		    	}
    		    			}
    		    		},
    		    		"percent" : {
    		    			"multiApprovalEvaluationPercent" : {
    		    				"name" : fmd_i18n_prop_multiApprovalEvaluationPercent,
    		    		    	"tooltip" : fmd_i18n_tip_multiApprovalEvaluationPercent,
    		    		    	"img" : "percent.png",
    		    		    	"asterisk" : true,
    		    		    	"cellType" : {
    		    		    		"type" : "jquispinner",
    		    		    		"config" : {
    		    		    			"min" : 1,
    		    		    			"max" : 99
    		    		    		}
    		    		    	},
    		    		    	"value" : {"default":50},
    		    		    	"validator" : "ValidPercent",
    		    		    	"validatorFunc" : function(elemid, value, prefix) {
    		    		    		if (Number(fl.curflow.bpmnConfig[elemid].isApprovalActivity) &&
    		    		    				'multiple'==fl.curflow.bpmnConfig[elemid].assignType 
    		    		    				&& 'percent'==fl.curflow.bpmnConfig[elemid].multiApprovalEvaluation 
    		    		    				&& !dhtmlxValidation.isValidPercent(value)) {
    		    		    			//return {"type":"error", "msg":fmd_i18n_vld_failed + " " + fldmeta_prop.runtime_validators_i18n["ValidPercent"]};
    		    		    			fl_pushValidationErr(elemid, "multiApprovalEvaluationPercent", "error", prefix + fmd_i18n_vld_failed + " " + fldmeta_prop.runtime_validators_i18n["ValidPercent"]);
    		    		    		}
    		    		    		return null;
    		    		    	}
    		    			}
    		    		}
    		    	}
    		    }
    		}
    	}
    };

//allow involve others
fldmeta_prop.func.UserTask.predefined["allowInvolve"] = {
		"name" : fmd_i18n_prop_allowInvolve,
    	"img" : "allowInvolve.png",
    	"tooltip" : fmd_i18n_prop_allowInvolve,
    	"cellType" : "ch",
    	"value" : {"default":0}
    };

//set data mapping 数据映射
fldmeta_prop.func.UserTask.predefined["dataMapping"] = {
    	"name" : fmd_i18n_prop_dataMapping,
    	"img" : "dataMapping.png",
    	"tooltip" : fmd_i18n_tooltip_dataMapping,
    	"cellType" : {
    		"type" : "btnex",
    		"config" : {
				"onclick" : fldmeta_prop.func.callSetDataMapping
			}
    	},
    	"value" : {"default":null},
    	"validatorFunc" : function(elemid, val, prefix) {
    		//验证是异步的，必须返回后再弹出验证信息
    		fldmeta_prop.func.getActivityVarsAndCheckValWithCallback(elemid, val, function(elemid, val, activityVars) {
    			if (!activityVars) return;
    			if (!val || MyUtilJs.isEmpty(val)) {
					/*if (!MyUtilJs.isEmpty(activityVars.input) || !MyUtilJs.isEmpty(activityVars.output)) {
						fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
					}*/
				} else {
					//检查映射的表单变量和流程变量是否有效
					for (var io in val) {
						for (var fv in val[io]) {
							//表单变量
							var fva = fv.split("|");
							var ioname = io=="input" ? fmd_i18n_title_dataMapping_input : fmd_i18n_title_dataMapping_output;
							try {
								var b1 = eval("activityVars[io][fva[0]].children[fva[1]]!=undefined");
								if (!b1) fl_pushValidationErr(elemid, "dataMapping", "error", prefix + 
										ioname + fmd_i18n_msg_invalidbindingformvar +fva[0]+"."+fva[1] + fmd_i18n_msg_reconfigdm); 
							}catch(e){
								fl_pushValidationErr(elemid, "dataMapping", "error", prefix + 
										ioname + fmd_i18n_msg_invalidbindingformvar +fva[0]+"."+fva[1] + fmd_i18n_msg_reconfigdm);
							}
							//流程变量
							if (!fldmeta_prop.func.isValidProcessVar(val[io][fv])) {
								fl_pushValidationErr(elemid, "dataMapping", "error", prefix + 
										ioname + fmd_i18n_msg_invalidmappingpvar +val[io][fv]);
							}
						}
					}
					//检查是否有未映射的
					/*var missing = false;
					if (!MyUtilJs.isEmpty(activityVars.input)) {
    					var in1 = val.input;
    					if (!in1) {
    						fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
    						missing = true;
    					} else {
    						var matchs1 = JSONSelect.match(":has(:root > .type)", activityVars.input);
    						//过滤prerequisite
    						var matchs = [];
    						for (var i in matchs1) {
    							!matchs1[i].path && (matchs.push(matchs1[i]));
    						}
    						//console.debug(matchs.length+"  >  "+MyUtilJs.getJsonKeyLength(in1));
    						if (matchs.length > MyUtilJs.getJsonKeyLength(in1)) {
    							fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
    							missing = true;
    						}
    					}
    				}
    				if (!missing && !MyUtilJs.isEmpty(activityVars.output)) {
    					var out1 = val.output;
    					if (!out1) {
    						fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
    					} else {
    						var matchs1 = JSONSelect.match(":has(:root > .type)", activityVars.output);
    						//过滤prerequisite
    						var matchs = [];
    						for (var i in matchs1) {
    							!matchs1[i].path && (matchs.push(matchs1[i]));
    						}
    						//console.debug(matchs.length+"  >  "+MyUtilJs.getJsonKeyLength(out1));
    						if (matchs.length > MyUtilJs.getJsonKeyLength(out1)) {
    							fl_pushValidationErr(elemid, "dataMapping", "warning", prefix + fmd_i18n_msg_noDatamapping);
    						}
    					}
    				}*/
				}
    		});
    	}
    };

//form binding
fldmeta_prop.func.UserTask.predefined["formBinding"] = {
		"name" : fmd_i18n_prop_formBinding,
    	"img" : "databinding.png",
    	"asterisk" : true,
    	"tooltip" : fmd_i18n_prop_formBinding,
    	"cellType" : {
			"type" : "btnex",
			"config" : {
				"displayValue" : "displayValue",
				"onclick" : fldmeta_prop.func.UserTask.selectForm
			}
		},
    	"value" : {"default":null},
    	"validatorFunc" : function(elemid, value, prefix) {
			if (MyUtilJs.isEmpty(value)) {
    			fl_pushValidationErr(elemid, "formBinding", "error", prefix + fmd_i18n_vld_failed +" "+ fmd_i18n_vld_notempty);
    		} else if (MyUtilJs.isEmpty(fl.curflow.otherConfig.validationData[elemid]["bindedFormModels"])) {
    			fl_pushValidationErr(elemid, "formBinding", "error", prefix + fmd_i18n_vld_failed +" "+ 
    					fmd_i18n_msg_invalidbindingform + value.formname +"，"+ fmd_i18n_prop_version +":"+ value.versionname);
    		}
		},
    	"sub" : {
    		"dataMapping" : fldmeta_prop.func.UserTask.predefined["dataMapping"]
    	}
};

//on component added
fldmeta_prop.funcOnCompAdded.UserTask = function(elemid, elem) {
	
};

//on component removed
fldmeta_prop.funcOnCompRemoved.UserTask = function(elemid, elem) {
	
};

//on component changed
fldmeta_prop.funcOnCompChanged.UserTask = function(elemid, elem) {
	fl.curflow.bpmnConfig[elemid]["i18nname-zh"] = fldmeta_prop.func.getCompInnerName(elemid);
};

//on color change of UserTask
fldmeta_prop.func.UserTask.onDisplayStyle = function(elemid, rId, nv) {
	if (rId=="displayStyle_GradientColor0") {
		var grd = Snap("svg").select("#Gradient_"+elemid);
		grd && grd.remove();
		var c0 = nv;
		var c1 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor1"]||flstyle.elem.gradients.Task.b;
		var c2 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor2"]||flstyle.elem.gradients.Task.c;
		grd = Snap("svg").paper.gradient("L(0, 0, 100, 100)"+c0+"-"+c1+":25-"+c2);
		grd.attr("id", "Gradient_"+elemid);
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr({"fill" : "url(#Gradient_"+elemid+")"});
	} else if (rId=="displayStyle_GradientColor1") {
		var grd = Snap("svg").select("#Gradient_"+elemid);
		grd && grd.remove();
		var c0 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor0"]||flstyle.elem.gradients.Task.a;
		var c1 = nv;
		var c2 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor2"]||flstyle.elem.gradients.Task.c;
		grd = Snap("svg").paper.gradient("L(0, 0, 100, 100)"+c0+"-"+c1+":25-"+c2);
		grd.attr("id", "Gradient_"+elemid);
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr({"fill" : "url(#Gradient_"+elemid+")"});
	} else if (rId=="displayStyle_GradientColor2") {
		var grd = Snap("svg").select("#Gradient_"+elemid);
		grd && grd.remove();
		var c0 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor0"]||flstyle.elem.gradients.Task.a;
		var c1 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor1"]||flstyle.elem.gradients.Task.b;
		var c2 = nv;
		grd = Snap("svg").paper.gradient("L(0, 0, 100, 100)"+c0+"-"+c1+":25-"+c2);
		grd.attr("id", "Gradient_"+elemid);
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr({"fill" : "url(#Gradient_"+elemid+")"});
	} else if (rId=="displayStyle_BorderEffect") {
		if (nv=='none' || !nv) {
			Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr("filter", null);
		} else {
			Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr("filter","url(#"+nv+")");
		}
	} else if (rId=="displayStyle_BorderStrokeWidth") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr({"strokeWidth" : parseInt(nv || flstyle.elem.defaultStrokeWidth)});
	} else if (rId=="displayStyle_BorderColor") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr({"stroke" : nv || flstyle.elem.defaultStroke});
	} else if (rId=="displayStyle_ActivityIconColor") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual").selectAll("path").forEach(function(el){
					el.attr({"stroke" : nv || flstyle.elem.defaultActivityIconColor});
				});
	} else if (rId=="displayStyle_fontColor") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual text").attr({"fill" : nv || flstyle.elem.defaultFontColor});
	} else if (rId=="displayStyle_showActivityIcon") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual").selectAll("path").forEach(function(el){
			var sval = "";
			var styles = el.attr("style");
			if (styles) {
				var sa = styles.split(";");
				if (sa && sa.length) {
					for (var i in sa) {
						if ($.trim(sa[i])) {
							var sas = $.trim(sa[i]).split(":");
							if ("display"!=sas[0]) sval += sas[0]+":"+$.trim(sas[1])+";";
						}
					}
				}
			}
			sval += (flstyle.elem.defaultActivityIconShow==nv ? "":"display:none;");
			el.attr({"style" : sval});
		});
	}
};

//properties settings for block
fldmeta_prop.control.UserTask = {
		"includes-properties" : {
			"common" : fldmeta_prop.common.all.properties,
			"activitycommon" : fldmeta_prop.common.activity.properties
		},
		"properties" : {
			"biz" : {
				"name" : fmd_i18n_prop_biz,
				"cellType" : "txt"
			},
			"bizvalue" : {
				"name" : fmd_i18n_prop_bizvalue,
				"cellType" : {
					"type" : "coro",
		    		"options" : [["1","低"],["2","中"],["3","高"]]
				},
				"value" : {"default":"2"}
			},
			"relatedbiz" : {
				"name" : fmd_i18n_prop_relatedbiz,
				"cellType" : "txt"
			},
			"risk" : {
				"name" : fmd_i18n_prop_risk,
				"cellType" : "txt"
			},
			"bizdata" : {
				"name" : fmd_i18n_prop_bizdata,
				"cellType" : "txt"
			},
			"bizdicision" : {
				"name" : fmd_i18n_prop_bizdicision,
				"cellType" : "txt"
			},
			"taskAssign" : {
				"name" : fmd_i18n_prop_taskAssign,
				"img" : "userTaskType.png",
				"cellType" : "ro",
		    	"displayOnly" : true,
		    	"sub" : {
		    		"assigneeType" : {
		    			"name" : fmd_i18n_prop_assignee,
		    			"img" : "roleactivity.png",
		    			"cellType" : "ed",
		    	    	"value" : {"default":""}
		    		},
		    		"readerType" : {
		    			"name" : fmd_i18n_prop_reader,
		    			"img" : "roleactivity.png",
		    			"cellType" : "ed",
		    	    	"value" : {"default":""}
		    		}
		    	}
			},
			"taskOperations" : {
				"name" : fmd_i18n_prop_taskOperations,
		    	"img" : "taskOperations.png",
		    	"tooltip" : fmd_i18n_prop_taskOperations,
		    	"cellType" : "ro",
		    	"displayOnly" : true,
		    	"sub" : {
		    		"isApprovalActivity" : fldmeta_prop.func.UserTask.predefined["isApprovalActivity"],
		    		"allowReject" : fldmeta_prop.func.UserTask.predefined["allowReject"],
		    		"allowInvolve" : fldmeta_prop.func.UserTask.predefined["allowInvolve"],
		    		"allowRecall" : {
						"name" : fmd_i18n_prop_allowRecall,
				    	"img" : "allowRecall.png",
				    	"tooltip" : fmd_i18n_prop_allowRecall,
				    	"cellType" : "ch",
				    	"value" : {"default":0}
					}
		    	}
			},
			"hasten" : {
				"name" : fmd_i18n_prop_durationhasten,
		    	"img" : "duration.png",
		    	"tooltip" : fmd_i18n_prop_durationhasten,
		    	"cellType" : "ro",
		    	"displayOnly" : true,
		    	"sub" : {
		    		"duration" : fldmeta_prop.common.predefined["duration"],
				    "remind" : fldmeta_prop.common.predefined["remind"],
				    /*"skipOnTimeout" : {
						"name" : fmd_i18n_prop_skipOnTimeout,
				    	"img" : "skip.png",
				    	"tooltip" : fmd_i18n_prop_skipOnTimeout,
				    	"cellType" : "ch",
				    	"value" : {"default":0}
					},*/
				    "manualRemind" : fldmeta_prop.common.predefined["manualRemind"]
		    	}
			}
		},
		"styles" : {
			"displayStyle" : {
				"name" : fmd_i18n_prop_tip_customstyle,
				"img" : "css.png",
		    	"cellType" : {
		    		"type" : "coro",
		    		"options" : fmd_i18n_prop_displayStyle_vals
		    	},
		    	"value" : {"default":"theme"},
		    	"conditional-sub" : {
		    		"custom" : {
		    			"displayStyle_GradientColor0" : {
		        			"name" : fmd_i18n_prop_color0,
		    		    	"cellType" : "cp",
		    		    	"img" : "color.png",
		    		    	"value" : function() {return flstyle.elem.gradients.Task.a}
		        		},
		    			"displayStyle_GradientColor1" : {
		        			"name" : fmd_i18n_prop_color1,
		    		    	"cellType" : "cp",
		    		    	"img" : "color.png",
		    		    	"value" : function() {return flstyle.elem.gradients.Task.b}
		        		},
		        		"displayStyle_GradientColor2" : {
		        			"name" : fmd_i18n_prop_color2,
		    		    	"cellType" : "cp",
		    		    	"img" : "color.png",
		    		    	"value" : function() {return flstyle.elem.gradients.Task.c}
		        		},
		        		//"displayStyle_ActivityIconColor" : fldmeta_prop.common.predefined["displayStyle_ActivityIconColor"],
		        		"displayStyle_fontColor" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_fontColor"]);
		    				obj1.value["default"] = flstyle.elem.defaultFontColor;
		    				return obj1;
		    			},
		        		"displayStyle_BorderStrokeWidth" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_BorderStrokeWidth"]);
		    				obj1.value["default"] = flstyle.elem.attrs.usertask.strokeWidth;
		    				return obj1;
		    			},
		        		"displayStyle_BorderColor" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_BorderColor"]);
		    				obj1.value["default"] = flstyle.elem.attrs.usertask.stroke;
		    				return obj1;
		    			},
		        		"displayStyle_BorderEffect" : fldmeta_prop.common.predefined["displayStyle_BorderEffect"]
		    		}
		    	}
			}
		},
		"abandon-properties" : fldmeta_prop.func.getAbandonPropertiesForConditional,
		"validationDataPrepare" : {//验证时用到的需要提前从其他系统读取的配置信息
			//读取表单绑定信息，并在页面暂存模型数据，用于验证formBinding和dataMapping两个属性
			"bindedFormModels" : function(elemid) {
				var form1 = fl.curflow.bpmnConfig[elemid]["formBinding"];
				if (!MyUtilJs.isEmpty(form1)) {
					return doPostAsyncJson(fmg.rest_queryv, {"formid":form1.formid, "versionid":form1.versionid},
							function(ret){
								//console.log(ret);
								if (!ret) return;
								fl.curflow.otherConfig.validationData[elemid]["bindedFormModels"] = fldmeta_prop.func.UserTask.parseModelToInputOutput(ret);
							}
						);
				}
				return null;
			},
			//读取引用角色信息稍后做有效性验证
			"assigneeRole" : function(elemid) {
				var role1 = fl.curflow.bpmnConfig[elemid]["assigneeRole"];
				if (!MyUtilJs.isEmpty(role1)) {
					return doGetAsyncJson(flvar.restCtx + "/auth/roleInfo/get?roleId="+role1.roleId, 
							function(ret){
								fl.curflow.otherConfig.validationData[elemid]["assigneeRole"] = ret;
							}
						);
				}
			},
			//读取引用岗位信息稍后做有效性验证
			"assigneeRelationRelationPosition" : function(elemid) {
				var pos1 = fl.curflow.bpmnConfig[elemid]["assigneeRelationRelationPosition"];
				if (!MyUtilJs.isEmpty(pos1)) {
					return doGetAsyncJson(flvar.bpmeRest+"/post/get?posId="+pos1.posId, 
							function(ret){
								fl.curflow.otherConfig.validationData[elemid]["assigneeRelationRelationPosition"] = ret;
							}
						);
				}
			}
		},
		"propDhxGridEvents" : {
			"onCellChanged" : function(rId,cId,nv) {
				fldmeta_prop.func.onCellChanged_common(rId,cId,nv,
						JSONSelect.match("."+rId, fldmeta_prop.control.UserTask));
				fldmeta_prop.func.onCellChanged_stylecommon(rId,cId,nv);
			}
		}
	};



